package jm.easyconfig;

import java.util.Collection;

import jm.easyconfig.MySqlConfigSource.CheckResultRecord;

public class ApplicationException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	public ApplicationException() {
		super();
	}

	public ApplicationException(String message) {
		super(message);
	}

	public ApplicationException(Throwable cause) {
		super(cause);
	}

	@Override
	public String getMessage() {
		String msg = super.getMessage();
		if (msg == null && this.getCause() != null)
			msg = this.getCause().getMessage();

		return msg;
	}
}

class OngoingConflictException extends ApplicationException {
	private static final long serialVersionUID = 1L;

	Collection<CheckResultRecord> items;

	public OngoingConflictException(Collection<CheckResultRecord> items) {
		super();
		this.items = items;
	}

	@Override
	public String getMessage() {

		return CfgHelper.jsonWrite(this.items);
	}

}

class AppIllegalAccessException extends ApplicationException {
	private static final long serialVersionUID = 1L;

	public AppIllegalAccessException() {
		super();
	}

	public AppIllegalAccessException(String message) {
		super(message);
	}

}
